#ifndef								__UDPSERVER_H__
#	define							__UDPSERVER_H__

#	include							<QtNetwork/QUdpSocket>
#	include							<qobject.h>
#	include							<list>
#	include							"QtAsyncUdpSocket.h"
#	include							"Processor.h"

class								UdpServer : public QObject
{

	Q_OBJECT
public:
	UdpServer(Processor &);
	~UdpServer();

public:
	void							sendToAll(IOrder*);
	void							connectToClient(std::string, std::string);
	void							disconnect(unsigned int id);


private:
	std::list<QtAsyncUdpSocket*>	_socket;
	Processor						&_proc;
	QUdpSocket						_server;
	byte							_tmp_buf[4096];
	unsigned short					_current_msg;
	IRotatingBuffer					*_buffer;

private slots:
	void							handle_read();

private:
	void							onReceive(int);
	void							getOrderSize();
};

#endif							// !__UDPSERVER_H__
